require(mapdata)
rm(list=ls())
setwd('/media/Iomega_HDD/boulot/Article/kd/last_23_01_2012/data/')	##Choose your path

data<-'Global_Data_2011_12_14v3.txt' 	##name of the dataset file

##################################get the dataset##################################
t<-read.table(data, header=T)

ag <- c("ag320","ag340", "ag380", "ag412", "ag443", "ag490", "ag510", "ag555")
ad <- c("ad320","ad340", "ad380", "ad412", "ad443", "ad490", "ad510", "ad555")

ind_ag <- which(colnames(t)%in%ag)
ind_ad <- which(colnames(t)%in%ad)

t[t==-999] <- NA

ag_value <- t[,ind_ag]
ad_value <- t[,ind_ad]

rm(list="t")

cdom_percent <- ag_value/(ag_value+ad_value)*100
 
postscript('../Figures/Figure5.ps', horizontal=F, height=10, width=10, paper="special")  
res<-cdom_percent
par(mar=c(5,5,1,1))
boxplot(res[,1], res[,2], res[,3], res[,4], res[,5], res[,6], res[,7], res[,8], names=c("320","340","380","412","443","490","510","555"), cex.axis=2, cex.lab=2,ylab="Contribution of CDOM to CDM absorption (%)", xlab=expression(paste(lambda, " (nm)", sep=" ")))
dev.off()
